<?php

namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;

class ShopWeekStat extends Model
{
    protected $table = 'shop_week_stat';		//related table name
    protected $guarded = [];

    //访问器：
    public function getTotalOrderMoneyAttribute($value)
    {
        try {
            return $value/100;
        } catch (DecryptException $e) {
            throw $e;
        }
    }


    //修改器：
    public function setTotalOrderMoneyAttribute($value)
    {
        $this->attributes['total_order_money']=$value*100;
    }


    //访问器：
    public function getUnitPriceAttribute($value)
    {
        try {
            return $value/100;
        } catch (DecryptException $e) {
            throw $e;
        }
    }


    //修改器：
    public function setUnitPriceAttribute($value)
    {
        $this->attributes['unit_price']=$value*100;
    }
}
